#ifdef TARG_SW5
#cc = sw5cc.old -host -O3 
#cc_slave = sw5cc.old  -O3
#endif

#ifdef TARG_SW3
#cc = swcc -O3 #-OPT: unroll_times_max=1 #-msimd 
#cc_slave = sw3cc -O3 #-OPT: unroll_times_max=1# -msimd
#endif
cc=swgcc -mhost -O3
cc_slave=swgcc -mslave -O3
cc_hybrid=swgcc -mhybrid -O3
#DAG_HOME=/home/export/base/shisuan/swyjs/online/jsh/DAG_HOME
DAG_HOME=/home/export/online1/mdt00/shisuan/swyjs/DYL/acemesh
SCHEDULER_INSTALL_PATH=${DAG_HOME}/dag_task_scheduler


EXTRA_FLAGS = -DSIZEX=258 -DSIZEY=258 -DSIZEZ=130 
#test8#EXTRA_FLAGS = -DSIZEX=18 -DSIZEY=18 -DSIZEZ=258

EXTRA_FLAGS+= -DTASK_BSIZE_1=1 -DTASK_BSIZE_2=2 -DTASK_BSIZE_3=128
#EXTRA_FLAGS+= -DTASK_BSIZE_1=4 -DTASK_BSIZE_2=4 -DTASK_BSIZE_3=128

#EXTRA_FLAGS+= -DBLKX=1 -DBLKY=2 -DBLKZ=128 -DDIST=1
#EXTRA_FLAGS+= -DBLKX=4  -DBLKY=4 -DBLKZ=128 -DDIST=1
#EXTRA_FLAGS+= -DBLKX=8  -DBLKY=8 -DBLKZ=128 -DDIST=1
EXTRA_FLAGS+= -DBLKX=16  -DBLKY=16 -DBLKZ=128 -DDIST=1
#EXTRA_FLAGS+= -DBLKX=32  -DBLKY=32 -DBLKZ=128 -DDIST=1
#EXTRA_FLAGS+= -DBLKX=64  -DBLKY=64 -DBLKZ=128 -DDIST=1
# EXTRA_FLAGS+= -DBLKX=128  -DBLKY=128 -DBLKZ=128 -DDIST=1
#EXTRA_FLAGS+=-D_3d27p # -S 
#EXTRA_FLAGS+=-DRESET_AFFI 
#EXTRA_FLAGS+=-DMASTER
#EXTRA_FLAGS+=-DFAKE_KERNEL
#EXTRA_FLAGS+=-DSCHEDULER
#EXTRA_FLAGS+= -DGRAPH_REUSE -DGRAPH_DIST=2

#EXTRA_FLAGS+= -DSLAVE_NESTED
EXTRA_FLAGS += -DMASTER_NESTED

EXTRA_FLAGS+= -DCHECK #-DSIZEX=542 -DSIZEY=542  -DSIZEZ=20 -DBLKX=12 -DBLKY=12 -DBLKZ=18 -D_PROFILING # -S 
CFLAGS = $(EXTRA_FLAGS)  -I${SCHEDULER_INSTALL_PATH}/include -L${SCHEDULER_INSTALL_PATH}/lib

LIBFLAGS =  -ldag_task_scheduler -lstdc++ -lm  -msimd  -lswperf

OBJECT_MMEM = 3d7p_master.o 3d7p_mmem.o
OBJECT_UNHIDE = 3d7p_master.o 3d7p_reuse_27_unhide.o
OBJECT_REUSE_1_1 = 3d7p_master.o 3d7p_reuse_1_1.o
OBJECT_REUSE_1_2 = 3d7p_master.o 3d7p_reuse_1_2.o
OBJECT_REUSE_27 = 3d7p_master.o 3d7p_reuse_27.o

mmem: 3d7p_master.o 3d7p_mmem.o 3d7p_mmem
reuse_27_unhide: 3d7p_master.o 3d7p_reuse_27_unhide.o 3d7p_reuse_27_unhide
reuse_1_1:3d7p_master.o 3d7p_reuse_1_1.o 3d7p_reuse_1_1
reuse_1_2:3d7p_master.o 3d7p_reuse_1_2.o 3d7p_reuse_1_2
reuse_27:3d7p_master.o 3d7p_reuse_27.o 3d7p_reuse_27


3d7p_master.o: 3d7p_master.c
	$(cc) $(CFLAGS) -c  3d7p_master.c  $(LIBFLAGS)
3d7p_mmem.o:  3d7p_mmem.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_mmem.c  $(LIBFLAGS) 
3d7p_reuse_27_unhide.o:  3d7p_reuse_27_unhide.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_reuse_27_unhide.c  $(LIBFLAGS) 
3d7p_reuse_1_1.o:3d7p_reuse_1_1.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_reuse_1_1.c  $(LIBFLAGS) 
3d7p_reuse_1_2.o:3d7p_reuse_1_2.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_reuse_1_2.c  $(LIBFLAGS)
3d7p_reuse_27.o:  3d7p_reuse_27.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_reuse_27.c  $(LIBFLAGS) 
3d7p_reuse_1_1:
	$(cc_hybrid)   $(CFLAGS) -I/usr/sw/penv/include -L/usr/sw/penv/lib -o 3d7p_reuse_1_1 $(OBJECT_REUSE_1_1) $(LIBFLAGS)
3d7p_reuse_1_2:
	$(cc_slave) -hybrid   $(CFLAGS)  -o 3d7p_reuse_1_2 $(OBJECT_REUSE_1_2) $(LIBFLAGS)
3d7p_reuse_27_unhide:
	$(cc_slave) -hybrid   $(CFLAGS)  -o 3d7p_27_unhide $(OBJECT_UNHIDE) $(LIBFLAGS)
3d7p_reuse_27:
	$(cc_slave) -hybrid   $(CFLAGS)  -o 3d7p_reuse_27 $(OBJECT_REUSE_27) $(LIBFLAGS)
3d7p_mmem:
	$(cc_slave) -hybrid   $(CFLAGS)  -o 3d7p_mmem $(OBJECT_MMEM) $(LIBFLAGS)
clean:
	@-rm -f *.o 3d7p_27 3d7p_reuse_27 3d7p_reuse_1_1 3d7p_reuse_1_2 3d7p_27_unhide 3d7p_mmem
